package com.larry.tinyweb.core.annotation;


/**
 * Created by larry on 16/12/12.
 * @author larry
 *
 * Annotation注册单元
 */
public class Unit {
    private final Class clasz;
    private String scope;
    private Object obj;

    public Unit(Class clasz, String scope) {
        this.clasz = clasz;
        this.scope = scope;
    }

    public Unit(Class clasz, Object obj) {
        this.clasz = clasz;
        this.obj = obj;
        this.scope = "singleton";
    }


    public Unit(Class clasz) {
        this.clasz = clasz;
        this.scope = "singleton";
    }

    public boolean isSingleton() {
        if ("singleton".equals(scope)) return true;
        else return false;
    }


    public Object getObj() {
        return obj;
    }

    public void setObj(Object obj) {
        this.obj = obj;
    }

    public Class getClasz() {
        return clasz;
    }
}
